	package com.lz.entity;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 * @客户信息类
 * @author 徐建林
 * @date 2018/10/21 11:52
 */

    @Entity
@Table

    @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,property = "@id")
    public class Customer implements Serializable{
    /**
	 * 
	 */
	private static final long serialVersionUID = -400753302376296061L;
	@Id
    @GeneratedValue(generator = "native")
    @GenericGenerator(name = "native",strategy = "native")
    /**客户编号*/
    private Integer customerId;
    /**客户姓名*/
    private String customerName;
    /**客户性别*/
    private Character sex;
    /**客户身份证号*/
    private String customerCardId;
    /**客户户籍*/
    private String customerHouseholdRegister;
    /**婚姻状况*/
    private String customerMaritalStatus;
    /**联系方式*/
    private String customerTel;
    /**住址*/
    private  String customerAddress;
    //用户的银行卡情况

     @NotFound(action = NotFoundAction.IGNORE)
     @OneToMany(targetEntity=CreditCard.class,mappedBy="customer")
    private Set<CreditCard> creditCardSet;
    //用户对应的房产

    @NotFound(action = NotFoundAction.IGNORE)
    @OneToMany(targetEntity=HouseProperty.class,mappedBy="customer")
    private Set<HouseProperty> housePropertySetnew;
    @OneToOne(targetEntity=Credit.class)
    @JoinColumn(name="creditId")
    @NotFound(action = NotFoundAction.IGNORE)
    private Credit credit;
    //客户拥有汽车情况
    @NotFound(action = NotFoundAction.IGNORE)
    @OneToMany(targetEntity=Car.class,mappedBy="customer")
    private Set<Car> carSet=new HashSet<>();
    //客户对应的order
    @NotFound(action = NotFoundAction.IGNORE)
    @OneToMany(targetEntity=OrderSheet.class,mappedBy="customer")
    private Set<OrderSheet> orderSet=new HashSet<>(); 
    //客户对应的
    //客户对应的公司
    @ManyToOne(targetEntity=Unit.class)
    @JoinColumn(name="unitId")
    private Unit unit;

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public Integer getCustomerId() {
        return customerId;
    }

    public void setCustomerId(Integer customerId) {
        this.customerId = customerId;
    }

    public String getCustomerName() {
        return customerName;
    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }

    public Character getSex() {
        return sex;
    }

    public void setSex(Character sex) {
        this.sex = sex;
    }

    public String getCustomerCardId() {
        return customerCardId;
    }

    public void setCustomerCardId(String customerCardId) {
        this.customerCardId = customerCardId;
    }

    public String getCustomerHouseholdRegister() {
        return customerHouseholdRegister;
    }

    public void setCustomerHouseholdRegister(String customerHouseholdRegister) {
        this.customerHouseholdRegister = customerHouseholdRegister;
    }

    public String getCustomerMaritalStatus() {
        return customerMaritalStatus;
    }

    public void setCustomerMaritalStatus(String customerMaritalStatus) {
        this.customerMaritalStatus = customerMaritalStatus;
    }

    public String getCustomerTel() {
        return customerTel;
    }

    public void setCustomerTel(String customerTel) {
        this.customerTel = customerTel;
    }

    public String getCustomerAddress() {
        return customerAddress;
    }

    public void setCustomerAddress(String customerAddress) {
        this.customerAddress = customerAddress;
    }

    public Set<CreditCard> getCreditCardSet() {
        return creditCardSet;
    }

    public void setCreditCardSet(Set<CreditCard> creditCardSet) {
        this.creditCardSet = creditCardSet;
    }

    public Set<HouseProperty> getHousePropertySetnew() {
        return housePropertySetnew;
    }

    public void setHousePropertySetnew(Set<HouseProperty> housePropertySetnew) {
        this.housePropertySetnew = housePropertySetnew;
    }

    public Credit getCredit() {
        return credit;
    }

    public void setCredit(Credit credit) {
        this.credit = credit;
    }

    public Set<Car> getCarSet() {
        return carSet;
    }

    public void setCarSet(Set<Car> carSet) {
        this.carSet = carSet;
    }

    public Set<OrderSheet> getOrderSet() {
        return orderSet;
    }

    public void setOrderSet(Set<OrderSheet> orderSet) {
        this.orderSet = orderSet;
    }

    public Unit getUnit() {
        return unit;
    }

    public void setUnit(Unit unit) {
        this.unit = unit;
    }
}
